//
//  TakeTableViewCell.m
//  FruitVIP
//
//  Created by 孙艳玲 on 15/5/26.
//  Copyright (c) 2015年 孙艳玲. All rights reserved.
//

#import "TakeTableViewCell.h"

#define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)
#define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)

@implementation TakeTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSub];
    }
    return self;
}

- (void)createSub
{
    if (SCREEN_WIDTH == 320 && SCREEN_HEIGHT == 480) {
        
        self.waitImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, SCREEN_WIDTH / 3, SCREEN_WIDTH/3)];
        //    waitImageView.backgroundColor = [UIColor yellowColor];
        self.waitImageView.userInteractionEnabled = YES;
        UIImage *image = [UIImage imageNamed:@"detailFood.png"];
       self. waitImageView.image = image;
        self.waitImageView.contentMode = UIViewContentModeScaleAspectFit;
        [self.contentView addSubview:self.waitImageView];
        
        UILabel *timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.waitImageView.frame.origin.x + self.waitImageView.frame.size.width + 10, self.waitImageView.frame.size.height / 3.8,  2 * self.waitImageView.frame.size.width / 3 - 5, self.waitImageView.frame.size.height / 6)];
        //    timeLabel.backgroundColor = [UIColor redColor];
        timeLabel.text = @"下单时间:";
        timeLabel.font = [UIFont systemFontOfSize:13];
        timeLabel.textColor = [UIColor lightGrayColor];
        [self.contentView addSubview:timeLabel];
        
        UILabel *detailTimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(timeLabel.frame.origin.x + timeLabel.frame.size.width , timeLabel.frame.origin.y, SCREEN_WIDTH - 20 - self.waitImageView.frame.size.width - timeLabel.frame.size.width , timeLabel.frame.size.height)];
        //    detailTimeLabel.backgroundColor = [UIColor blueColor];
        detailTimeLabel.text = @"2015/5/18 11:15:30";
        detailTimeLabel.font = [UIFont systemFontOfSize:13];
        detailTimeLabel.textColor = [UIColor grayColor];
        [self.contentView addSubview:detailTimeLabel];
        
        UILabel *payLabel = [[UILabel alloc] initWithFrame:CGRectMake(timeLabel.frame.origin.x, timeLabel.frame.origin.y + timeLabel.frame.size.height + 5, timeLabel.frame.size.width, timeLabel.frame.size.height)];
        payLabel.text = @"支付方式:";
        payLabel.font = [UIFont systemFontOfSize:13];
        payLabel.textColor = [UIColor lightGrayColor];
        [self.contentView addSubview:payLabel];
        
        UILabel *detailPayLabel = [[UILabel alloc] initWithFrame:CGRectMake(detailTimeLabel.frame.origin.x, payLabel.frame.origin.y, detailTimeLabel.frame.size.width, payLabel.frame.size.height)];
        detailPayLabel.text = @"支付宝支付";
        detailPayLabel.font = [UIFont systemFontOfSize:13];
        detailPayLabel.textColor = [UIColor grayColor];
        [self.contentView addSubview:detailPayLabel];
        
        UILabel *moneyLabel = [[UILabel alloc] initWithFrame:CGRectMake(payLabel.frame.origin.x, payLabel.frame.origin.y + payLabel.frame.size.height + 5, payLabel.frame.size.width, payLabel.frame.size.height)];
        moneyLabel.text = @"订单金额:";
        moneyLabel.font = [UIFont systemFontOfSize:13];
        moneyLabel.textColor = [UIColor lightGrayColor];
        [self.contentView addSubview:moneyLabel];
        
        UILabel *allMoneyLabel = [[UILabel alloc] initWithFrame:CGRectMake(detailPayLabel.frame.origin.x, moneyLabel.frame.origin.y, detailPayLabel.frame.size.width, detailPayLabel.frame.size.height)];
        allMoneyLabel.textColor = [UIColor grayColor];
        allMoneyLabel.text = @"79.00";
        allMoneyLabel.font = [UIFont systemFontOfSize:13];
        NSString *str = @"￥";
        allMoneyLabel.text = [str stringByAppendingString:allMoneyLabel.text];
        
        [self.contentView addSubview:allMoneyLabel];

    }
    else
    {
   self.waitImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, SCREEN_WIDTH / 3, SCREEN_WIDTH/3)];
//    waitImageView.backgroundColor = [UIColor yellowColor];
    self.waitImageView.userInteractionEnabled = YES;
    UIImage *image = [UIImage imageNamed:@"detailFood.png"];
    self.waitImageView.image = image;
    self.waitImageView.contentMode = UIViewContentModeScaleAspectFit;
    [self.contentView addSubview:self.waitImageView];
    
    UILabel *timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.waitImageView.frame.origin.x +self. waitImageView.frame.size.width + 10, self.waitImageView.frame.size.height / 3.8,  2 * self.waitImageView.frame.size.width / 3 - 5, self.waitImageView.frame.size.height / 6)];
    //    timeLabel.backgroundColor = [UIColor redColor];
    timeLabel.text = @"下单时间:";
    timeLabel.font = [UIFont systemFontOfSize:13];
    timeLabel.textColor = [UIColor lightGrayColor];
    [self.contentView addSubview:timeLabel];
    
    UILabel *detailTimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(timeLabel.frame.origin.x + timeLabel.frame.size.width , timeLabel.frame.origin.y, SCREEN_WIDTH - 20 - self.waitImageView.frame.size.width - timeLabel.frame.size.width , timeLabel.frame.size.height)];
    //    detailTimeLabel.backgroundColor = [UIColor blueColor];
    detailTimeLabel.text = @"2015/5/18 11:15:30";
    detailTimeLabel.font = [UIFont systemFontOfSize:13];
    detailTimeLabel.textColor = [UIColor grayColor];
    [self.contentView addSubview:detailTimeLabel];
    
    UILabel *payLabel = [[UILabel alloc] initWithFrame:CGRectMake(timeLabel.frame.origin.x, timeLabel.frame.origin.y + timeLabel.frame.size.height + 5, timeLabel.frame.size.width, timeLabel.frame.size.height)];
    payLabel.text = @"支付方式:";
    payLabel.font = [UIFont systemFontOfSize:13];
    payLabel.textColor = [UIColor lightGrayColor];
    [self.contentView addSubview:payLabel];
    
    UILabel *detailPayLabel = [[UILabel alloc] initWithFrame:CGRectMake(detailTimeLabel.frame.origin.x, payLabel.frame.origin.y, detailTimeLabel.frame.size.width, payLabel.frame.size.height)];
    detailPayLabel.text = @"支付宝支付";
    detailPayLabel.font = [UIFont systemFontOfSize:13];
    detailPayLabel.textColor = [UIColor grayColor];
    [self.contentView addSubview:detailPayLabel];
    
    UILabel *moneyLabel = [[UILabel alloc] initWithFrame:CGRectMake(payLabel.frame.origin.x, payLabel.frame.origin.y + payLabel.frame.size.height + 5, payLabel.frame.size.width, payLabel.frame.size.height)];
    moneyLabel.text = @"订单金额:";
    moneyLabel.font = [UIFont systemFontOfSize:13];
    moneyLabel.textColor = [UIColor lightGrayColor];
    [self.contentView addSubview:moneyLabel];
    
    UILabel *allMoneyLabel = [[UILabel alloc] initWithFrame:CGRectMake(detailPayLabel.frame.origin.x, moneyLabel.frame.origin.y, detailPayLabel.frame.size.width, detailPayLabel.frame.size.height)];
    allMoneyLabel.textColor = [UIColor grayColor];
    allMoneyLabel.text = @"79.00";
    allMoneyLabel.font = [UIFont systemFontOfSize:13];
    NSString *str = @"￥";
    allMoneyLabel.text = [str stringByAppendingString:allMoneyLabel.text];

    [self.contentView addSubview:allMoneyLabel];
    }

}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
